knitr::opts_chunk$set(
  fig.width=8, 
  fig.height=7,
  fig.align = "center"
)

Introduction

During my life in Morocco, I have always been told how great of a nation we were in all aspects. Education was one of them, and one common standard was to depict us as excellent in mathematics, without any real proof of that. Until recently, this is the first result that you could find on Internet while typing “Moroccans are good at mathematics”. We excel, how wonderful is this!

However, growing up, I realized that the poverty I was surrounded by depicted a deep-rooted defect in education. In 2018, the OECD proposed Morocco to take the PISA test, which measures 15-year-olds’ ability to use their reading, mathematics and science knowledge to meet real-life challenges.This is what happened:

The result is clear : “PISA : Moroccan students have poor reading, Math, Science abilities”. This picture shows that data can radically transform the paradigms and beliefs underlying a whole education system. It is time for Morocco to adopt a data-driven approach to solve institutional problems, especially in education. We need to fix our system’s chronic dysfunctions because they result in an exorbitant cost that the country bears in setting up its education system and an uncertain future for learners.

We need to visualize data in a truthful and enlightening way (Alberto Cairo’s principles) in order to get out of this collective blindness. Let us understand where we truly stand.

Literacy rate

The big picture

First, we start with the most basic indicator of a country’s education : Literacy Rate.

It is clear that Morocco is far behind the rest of the world. But is the situation really bad? Are the means allocated to increasing the literacy rate sufficient?

Zoom on generations

## # A tibble: 4 x 4
##   region  literacy_rate age_group Gender
##   <chr>           <dbl> <chr>     <chr> 
## 1 Morocco          98.0 Young     Men   
## 2 Morocco          97.4 Young     Women 
## 3 Morocco          51.4 Elder     Men   
## 4 Morocco          19.0 Elder     Women

> The picture is now clearer : Morocco’s literacy rate is driven down by the older generation. This generation was indeed rural based and had less access to schools. Moreover, Morocco’s education was mainly based on Quran (read by professors) rather than academic programs such as we know them today.We also notice a drastic reduction in gender gap, which further proves that the situation of literacy rate in Morocco is actually improving a lot more than we initially thought!

Understand the country’s evolution

How did we reach this point? Why is the youth literacy rate so high today?

Before diving too much into details, let us recall a few facts and definitions : + Primary school: Age 6 to 11 + Lower secondary school : Age 12 to 15

  • Net enrolment rate in primary school : The number of pupils of official primary school age who are enrolled in primary education as a percentage of the total children of the official school age population

  • Completion rate in primary school : The proportion of enrolled primary school pupils that complete primary school.

  • Lower secondary school drop-out rate : The cumulative drop-out rate until the last grade of lower secondary school.

Net enrolment rate and completion rate for primary schools have sharply increased since 1970. The main decrease happened in 1987, when the minister of education Dr.Azzedine Laraki imposed the arabization and islamization of academic programs. Furthermore, King Hassan II ordered to remove philosophy and sociology from all programs in order to better control population. This had an abrupt effect on primary school enrolment and completion rate, but the situation came back to normal in the early 1990’s. Nearly all kids are now enrolled in primary school and complete it, which explains why the youth literacy rate is so high compared to the older generation.

The lower secondary school drop-out rate has not improved at all during the last 40 years. Moroccan 15 years old students know how to read and write since they went to primary school. However, can they use their abilities to meet real-life challenges? How well can they use their reading,science and mathematics skills in real settings? This is exactly what the Programme for International Student Assessment (PISA) tests for.

PISA scores

##Histogram

The high youth literacy rate is very positive, but it is clearly not enough to assert that Morocco’s educational system is great. The country underperforms on all PISA subjects compared to the rest of the world, indicating that even though 15 years old students are literate, they still struggle to use their skills to meet real-life challenges because too many of them have dropped out before the last year of lower secondary school.

Map visualization

#Read in the data
userBasedData_raw <- read.csv(file="Morocco.csv",header=TRUE,na.strings=c("..","NA"))

The objective of this part of the code is to generate relevant map visualizations using R in combination with Tableau.

The first question we want to explore is: how is Morocco’s performance compared to the rest of the world’s? Does Morocco perform well or badly? We will base our investigation on the average PISA scores ( as average, we consider the average of mathematics, science and reading scores).

#Select relevant data for subsequent plots.
Morocco <- userBasedData_raw %>%

#Select data corresponding to X2018..YR2018.
select(Country.Name,Country.Code,Series,X2018..YR2018.)%>%
#Choose the relevant variables.
filter(Series %in% c("PISA: Mean performance on the science scale", "PISA: Mean performance on the reading scale","PISA: Mean performance on the mathematics scale","Youth literacy rate, population 15-24 years, both sexes (%)","GDP at market prices (current US$)   ","GDP at market prices (current US$)","Government expenditure on education as % of GDP (%)","Adult literacy rate, population 15+ years, both sexes (%)"))

#Organise the data in a neater way using pivot_wider
Morocco1<-Morocco%>%
  pivot_wider(names_from=Series,values_from=X2018..YR2018.)

#Clean the data corresponding to PISA scores.
Morocco1_PISA<-Morocco1%>%
  #Get only existen non-na values, (i.e. filter out NA values)
  filter(!is.na(`PISA: Mean performance on the science scale`)&!is.na(`PISA: Mean performance on the reading scale`)&!is.na(`PISA: Mean performance on the mathematics scale`))%>%
  #Select PISA performance scores
  select(Country.Name,Country.Code,`PISA: Mean performance on the science scale`,`PISA: Mean performance on the reading scale`,`PISA: Mean performance on the mathematics scale`)%>%
  #Create a new variable Average PISA which is an average of the scores in science, maths and reading
  mutate(AVG_PISA=(`PISA: Mean performance on the science scale`+`PISA: Mean performance on the reading scale`+`PISA: Mean performance on the mathematics scale`)/3)

#Export the data corresponding to PISA scores to excel file.
# Need to load library(xlsx) 
#Uncomment if Excel file is needed
#write.xlsx(Morocco1_PISA, file = "Morocco_PISA.xlsx",
 #     sheetName = "MoroccoPisa", append = FALSE)

#Plot produced with Tableau using the previous Excel file
library(png)
library(grid)
img0<-readPNG('Ave_PISA_Morocco1.png')
grid.raster(img0)

On the map, we can see that Moroccans’ average performance isn’t good. As benchmarks against which we can compare Morocco’s performance, we have highlighted worst and best performing countries, Dominican Republic and China, respectively. Morocco’s average score is 367.9 compared to Dominican Republic’s 334.1 and China’s 579.

After understanding Morocco’s performance in comparison to the rest of the world, we want to further explore the variables that may contribute to the country’s underperformance. Primary and secondary education are interesting variables to consider since people taking the PISA scores are young high school students (15 and 16 year old).

Therefore, we’re going to take a look at net enrolment in primary and secondary education and compare Morocco’s numbers with the rest of the world’s.

#Raw data corresponding to primary, secondary education enrolment 
primary_secondary_raw<-read.csv(file="primary_secondary.csv",header=TRUE,na.strings=c("..","NA"))

#PRIMARY NET ENROLMENT

# Select and filter to obtain the relevant data 
primary <- primary_secondary_raw %>%
  select(Country.Name,Country.Code,Series,`X2018..YR2018.`) %>%
  #Filter out NA values
   filter(!is.na(X2018..YR2018.)) %>%
 #Choose only data corresponding to primary net enrolment rate
 filter(Series %in% c("Net enrolment rate, primary, both sexes (%)"))%>%
  pivot_wider(names_from=Series,values_from=X2018..YR2018.)

 # Export the relevant data to file Morocco_net_primary1.xlsx
# (Uncomment if excel file is needed)

# write.xlsx(primary, file = "Morocco_net_primary1.xlsx",
      # sheetName = "Morocco_net_primary1", append = FALSE)
#Plot produced with Tableau using the previous Excel file
img2<-readPNG('Net_Primary_Morocco1.png')
grid.raster(img2)

This map tells us how Morocco’s net primary enrolment rate compares to other countries’. We can observe that Morocco has a high net primary enrolment rate, comparable to high-performing countries’. This indicates that the key to the Morocco’s underperformance in PISA tests is not linked to primary education enrolment rates. Let’s investigate net secondary enrolment rates!

#SECONDARY NET ENROLMENT 

# Select and filter to obtain the relevant data 
primary_secondary <- primary_secondary_raw %>%
  #Select the relevant data variables
  select(Country.Name,Country.Code,Series,`X2018..YR2018.`) %>%
  #Filter out NA values
   filter(!is.na(X2018..YR2018.)) %>%
  #Choose only data corresponding to secondary net enrolment rate
 filter(Series %in% c("Net enrolment rate, secondary, both sexes (%)"))%>%
  pivot_wider(names_from=Series,values_from=X2018..YR2018.)

# Export the relevant data to file Morocco_net_secondary1.xlsx
# Uncomment if Excel file is needed

# write.xlsx(primary_secondary, file = "Morocco_net_secondary1.xlsx",
      # sheetName = "Morocco_net_secondary1", append = FALSE)

#Plot produced with Tableau using the previous Excel file
#knitr::include_graphics('Net_Secondary_Morocco.png')
img1<-readPNG('Net_Secondary_Morocco1.png')
grid.raster(img1)

On the map, we can observe the world countries’ net secondary enrolment rate. Particularly, we can see that Morocco has a low net secondary enrolment rate of only 63.47%. Some other low-performing countries such as Dominican Republic and Panama also have low enrolment rates. In contrast, high-performing countries such as Canada and Finland have very high net secondary enrolment rates, close to 100%.

We can conclude that, unlike net primary enrolment rate, net secondary enrolment rate is generally different for high and low performing countries: countries that performed badly tend to have a significantly lower net secondary enrolment rate than countries that performed well.